<?php
include_once "../includes/myfunction.php";
include_once "../ini.php";
include "../thu_vien/xl_user.php";
include "../thu_vien/xl_work.php";
include "../thu_vien/xl_position.php";
include "../thu_vien/xl_location.php";
include "../thu_vien/xl_employer.php";
include "../thu_vien/xl_education.php";
include "../thu_vien/xl_class.php";
include "../thu_vien/xl_school.php";
include "../thu_vien/xl_class_member.php";
include "../thu_vien/xl_concentration.php";
include "../thu_vien/xl_concentration_member.php";

$dt_xl_user = new xl_user;
$dt_xl_work = new xl_work;
$dt_xl_position = new xl_position;
$dt_xl_location = new xl_location;
$dt_xl_employer = new xl_employer;
$dt_xl_education = new xl_education;

$dt_xl_education = new xl_education;
$dt_xl_class = new xl_class;
$dt_xl_school = new xl_school;
$dt_xl_class_member = new xl_class_member;
$dt_xl_concentration = new xl_concentration;
$dt_xl_concentration_member = new xl_concentration_member;

if ($_POST['name'] == '') {
	$_SESSION['msg'] = 'Lỗi! Vui lòng nhập họ tên';
	$_SESSION['type_msg'] = 'error';
	header('Location: '.$_SERVER['HTTP_REFERER']);
	exit;
}

#cập nhật dữ liệu
	$kq = $dt_xl_user->cap_nhat($_POST['uid'], $_POST['name'], $_POST['link'], $_POST['username'], $_POST['bio'], $_POST['quote'], $_POST['sex'], $_POST['timezone'], $_POST['religion'], $_POST['birthday'], $_POST['hometown_location'], $_POST['meeting_sex'], $_POST['meeting_for'], $_POST['relationship_status'], $_POST['significant_other_id'], $_POST['political'], $_POST['current_location'], $_POST['activities'], $_POST['interests'], $_POST['music'], $_POST['tv'], $_POST['movies'], $_POST['books'], $_POST['about_me'], $_POST['notes_count'], $_POST['wall_count'], $_POST['status'], $_POST['profile_url'], $_POST['pic_with_logo'], $_POST['allowed_restrictions'], $_POST['website'], $_POST['is_blocked'], $_POST['contact_email'], $_POST['email'], $_POST['games'], $_POST['work'], $_POST['education'], $_POST['sports'], $_POST['favorite_athletes'], $_POST['favorite_teams'], $_POST['languages'], $_POST['likes_count'], $_POST['friend_count'], $_POST['mutual_friend_count'], $_POST['can_post'], $_POST['locale'], $_POST['verified'], $_POST['profile_update_time']);
	
	if (!$kq) {
		$_SESSION['msg']= 'Lỗi! Cập nhật thất bại!';
		$_SESSION['type_msg'] = 'error';
		header("Location: ".$_SERVER['HTTP_REFERER']);
		exit;
	}
	else {
	#thông báo
	$_SESSION['msg']= "Thành công! Dữ liệu đã được cập nhật!";
	$_SESSION['type_msg'] = 'success';
	header("Location: edit.php");
	}
	
?>